using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace WPCoco.Tasks
{
    public class EaseBackInOutFunction : EaseFunction
    {
        public EaseBackInOutFunction(float overshoot)
        {
            this.overshoot = overshoot;
        }

        readonly float overshoot;

        public override float Evaluate(float time)
        {
            time = time * 2;
            if (time < 1)
            {
                return (time * time * ((overshoot + 1) * time - overshoot)) / 2;
            }
            else 
            {
                time = time - 2;
                return (time * time * ((overshoot + 1) * time + overshoot)) / 2 + 1;
            }
        }
    }
}
